﻿using System;
using System.Collections.Generic;
using System.Text;
using com.lover.astd.common.logic;
using com.lover.astd.common.model;

namespace com.lover.astd.common.logicexe.economy
{
    public class StoneExe : ExeBase
    {
        public StoneExe() { _name = ConfigStrings.S_Stone; _readable = ConfigStrings.SR_Stone; }
        public override long execute()
        {
            Dictionary<string, string> conf = getConfig();
            if (!conf.ContainsKey(ConfigStrings.enabled) || !conf[ConfigStrings.enabled].ToLower().Equals("true")) return next_day();
            int gather_percent = 50;
            if (conf.ContainsKey(ConfigStrings.ratio)) Int32.TryParse(conf[ConfigStrings.ratio], out gather_percent);

            MiscMgr mgr = ServiceFactory.getMiscManager();
            mgr.handleStoneInfo(_proto, _logger, gather_percent);
            // no matter what result is, half an hour later to check again
            return next_halfhour();
        }
    }
}
